﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mofang.Utils.LogProvider
{
	internal static class BaseUtils
	{
		/// <summary>
		/// 获取根路径
		/// </summary>
		/// <returns></returns>
		public static string MapRootPath(this string fileName)
		{
			string root = System.Web.Hosting.HostingEnvironment.MapPath("~") != null
				? System.Web.Hosting.HostingEnvironment.MapPath("~") + @"bin\"
				: string.Empty;

			if (string.IsNullOrEmpty(root))
			{
				root = (System.Web.HttpContext.Current != null)
							  ? System.Web.HttpContext.Current.Request.MapPath("~") + @"bin\"
							  : string.Empty;
			}
			return root + fileName;
		}
	}
}
